{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import rabbitpy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "with rabbitpy.Connection() as connection:\n",
    "    with connection.channel() as channel:\n",
    "        exchange = rabbitpy.Exchange(channel, 'chapter4-example')\n",
    "        exchange.declare()\n",
    "        channel.enable_publisher_confirms()\n",
    "        message = rabbitpy.Message(channel,\n",
    "                                   'This is an important message',\n",
    "                                   {'content_type': 'text/plain',\n",
    "                                    'message_type': 'very important'})\n",
    "        if message.publish('chapter4-example', 'important.message'):\n",
    "            print('The message was confirmed')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
